using System;
using System.Data;
using System.Data.Odbc;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Collections.Generic;

/// <summary>
/// Summary description for Sql
/// </summary>
public class ReviewerOdbc
{
    public static OdbcDataReader Read(string SQLstreng)
    {
        string MyConn = ConfigurationManager.ConnectionStrings["reviewer"].ConnectionString;
        OdbcConnection dbconn = new OdbcConnection(MyConn);
        OdbcCommand MyCommand = new OdbcCommand();

        dbconn.Open();

        try
        {
            MyCommand.Connection = dbconn;
            MyCommand.CommandType = CommandType.Text;
            MyCommand.CommandText = SQLstreng;

            return MyCommand.ExecuteReader(CommandBehavior.CloseConnection);
        }
        finally
        {
            //dbconn.Close();
        }
    }

    public static string Execute(string SQLstreng)
    {
        string MyConn = ConfigurationManager.ConnectionStrings["reviewer"].ConnectionString;
        OdbcConnection dbconn = new OdbcConnection(MyConn);
        OdbcCommand MyCommand = new OdbcCommand();

        dbconn.Open();

        MyCommand.Connection = dbconn;
        MyCommand.CommandType = CommandType.Text;
        MyCommand.CommandText = SQLstreng;

        MyCommand.ExecuteNonQuery();

        return "Done";

        dbconn.Close();
    }

    public static string TEST()
    {
        return "HEJ";
    }
}